package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.VipService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;
import com.junzhiit.nengji.cms.web.vo.VipVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/vip")
public class VipController extends BaseController{

	@Autowired
	private VipService vipService;
	
	@ApiOperation(value = "查询所有用户身份")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp) {
		return vipService.findAll(dtp);
	}
	
	@ApiOperation(value = "根据ID查询相应信息")
	@RequestMapping(value="/find",method = RequestMethod.GET)
	public ResultVO findById(String id) {
		AssertUtil.notBlank(id, "id is required");
		return vipService.findById(id);
	}
	
	@ApiOperation(value = "修改用户身份")
	@RequestMapping(value="/update",method = RequestMethod.PUT)
	public ResultVO update(VipVO vipVO) {
		return vipService.update(vipVO);
	}
	
	@ApiOperation(value = "新建用户身份")
	@RequestMapping(method = RequestMethod.POST)
	public ResultVO add(VipVO vipVO) {
		return vipService.add(vipVO);
	}
	
	@ApiOperation(value = "删除用户身份")
	@RequestMapping(method = RequestMethod.PUT)
	public ResultVO del(String id) {
		return vipService.del(id);
	}
	
	@ApiOperation(value = "根据ID查询相应信息")
	@RequestMapping(value="/find/name",method = RequestMethod.GET)
	public ResultVO getVipName() {
		return vipService.getVipName();
	}
}
